import React, { Component } from 'react';
import { View, Text } from '@tarojs/components'
import './integral.scss'
import PropTypes from 'prop-types'

interface StateType {
    name: string
    total: number
    startDate: string
    endDate: string
    status: 0 | -1 | 1
    mode: 'redbag' | 'integral'
    time: string
    memo: string
}
// status 0 未使用  1已使用  -1 已过期
export default class IntegraList extends Component<StateType> {
    static defaultProps = {
        name: '',
        total: 0,
        startDate: '',
        endDate: '',
        status: 0,
        mode: 'integral',
        time: '',
        memo: '',
    }
    static propTypes = {
        name: PropTypes.string.isRequired,
        total: PropTypes.number,
        startDate: PropTypes.string,
        endDate: PropTypes.string,
        status: PropTypes.number,
        mode: PropTypes.string.isRequired,
        time: PropTypes.string,
        memo: PropTypes.string,
    }
    render() {
        return (
            <View className='integralRoot'>
                <View className='head'>
                    <View className='name'>{this.props.name}</View>
                  <View className='price'><Text className='text'>{this.props.total > 0 ? '+'+this.props.total : this.props.total}</Text></View>

                </View>
                <View className='foot'>{this.props.time}</View>
            </View>
        )
    }
}
